<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGroundPlanConfTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('ground_plan_conf', function (Blueprint $table) {
            $table->increments('id');
            $table->string('ground_name',25)->comment('地推名称');
            $table->string('city_id',11)->comment('城市id');
            $table->string('groud_scheme_type',5)->comment('地推方案类型');
            $table->string('ground_type',5)->comment('地推类型1：个人地推 2：商家地推');
            $table->string('balance_cycle_type',5)->comment('结算周期类型');
            $table->string('balance_describe',255)->comment('结算周期描述');
            $table->string('validate_ground_define',255)->comment('有效地推定义');
            $table->string('ground_balance_describe',500)->comment('地推结算描述');
            $table->decimal('valid_register_fee',16,2)->default(0.00)->comment('有效地推的注册用户金额');
            $table->decimal('consume_activity_fee_limit',16,2)->default(0.00)->comment('每笔消费实付金额限制');
            $table->decimal('each_order_piece_fee',16,2)->default(0.00)->comment('每笔订单计件金额');
            $table->decimal('each_activity_fee_piece_percent',16,4)->default(0.0000)->comment('每笔消费按实付金额百分比');
            $table->decimal('each_first_recharge_fee_limit',16,2)->default(0.00)->comment('用户首笔充值金额限制');
            $table->decimal('each_recharge_pirce_fee',16,2)->default(0.00)->comment('每笔充值订单计件金额');
            $table->decimal('each_recharge_fee_limit',16,2)->default(0.00)->comment('用户充值金额限制');
            $table->string('user_recharge_amount_before',11)->default(0)->comment('之前用户充值数量');
            $table->string('register_amount_before',11)->default(0)->comment('之前注册用户数量');
            $table->string('register_amount_after',11)->default(0)->comment('之后注册用户数量');
            $table->decimal('register_fee_before',16,2)->default(0.00)->comment('之前注册用户金额');
            $table->decimal('register_fee_after',16,2)->default(0.00)->comment('之后注册用户金额');
            $table->decimal('each_order_piece_percent_after',11,4)->default(0.0000)->comment('之后每笔消费按实付金额百分比');
            $table->decimal('each_order_piece_percent_Before',11,4)->default(0.0000)->comment('之前每笔消费按实付金额百分比');
            $table->string('groud_salesman_amount',11)->default(0)->comment('地推人员数量');
            $table->string('status',5)->comment('状态（0：为生效 1：为失效）');
            $table->dateTime('effect_date')->comment('生效时间');
            $table->dateTime('invalid_date')->comment('失效时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('ground_plan_conf');
    }
}
